<div id="module_cart" class="box">
    <?php if ($products) { ?>
	<div id='short_cart' style="display:none"  class="thickbox" >
    <table cellpadding="2" cellspacing="0" style="width: 100%;">
      <?php foreach ($products as $product) { ?>
      <tr>
        <td align="left" valign="top" width="1"><span class="cart_remove" id="remove_<?php echo $product['key']; ?>">&nbsp;</span></td><td valign="top" align="right" width="1"><?php echo $product['quantity']; ?>&nbsp;x&nbsp;</td>
        <td align="left" valign="top"><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a>&nbsp;(<?php echo $product['price']; ?>)
          <div>
            <?php foreach ($product['option'] as $option) { ?>
            - <small style="color: #999;"><?php echo $option['name']; ?> <?php echo $option['value']; ?></small><br />
            <?php } ?>
          </div></td>
      </tr>
      <?php } ?>
    </table>
    <br />
    <table cellpadding="0" cellspacing="0" align="right" style="display:inline-block;">
      <?php foreach ($totals as $total) { ?>
      <tr>
        <td align="right"><span class="cart_module_total"><b><?php echo $total['title']; ?></b></span></td>
        <td align="right"><span class="cart_module_total"><?php echo $total['text']; ?></span></td>
      </tr>
      <?php } ?>
    </table>
    <div style="padding-top:5px;text-align:center;clear:both;"><a href="<?php echo $view; ?>"><img src="catalog/view/theme/w4u/img/viewcart.png" align="absmiddle" title="<?php echo $text_view; ?>"/></a>&nbsp;&nbsp;&nbsp;<a href="<?php echo $checkout; ?>"><img src="catalog/view/theme/w4u/img/checkout.png" align="absmiddle" title="<?php echo $text_checkout; ?>"/></a></div>
	</div>
<p class="whitetext"><a id="button_sortcart" onmouseover="show_short_cart(<?php echo count($products); ?>)"  class="thickbox" href="" title="<?php echo $text_view; ?>"><?php echo strtoupper($heading_title); ?></a></p>
          <p class="whitetext"><?php echo $quantity.$text_item ; ?></p>
          <p class="whitetext"><?php echo $text_totals; ?> <span class="redtext"><?php echo $text_totals_value; ?></span></p>
	
    <?php 
	} 
	else 
	{ ?>
	<p class="whitetext"><a href="<?php echo $view; ?>"><?php echo $heading_title; ?></a></p>
    <p class="whitetext"><?php echo $text_empty; ?></p>
    <?php 
	} 
	?>
</div>
<?php if ($ajax) { ?>
<script type="text/javascript" src="catalog/view/javascript/jquery/ajax_add.js"></script>
<?php } ?>

<script type="text/javascript">
function show_short_cart(percent)
{
	// NDK - auto height of thickbox
	/*var h90 = $(window).height();
	h90 = Math.round(h90 * percent);
	$(window).bind("resize", function(e){
	var h90 = $(window).height();
	h90 = Math.round(h90 * percent);
	});*/
	var temp=10;
	if((percent>3)&&(percent<6))
	{
		temp=12;
	}
	else if((percent>=6)&&(percent<10))
	{
		temp=13.5;
	}
	else
	{
		temp=14;
	}
	var h90 =130+percent*temp;
	$("a#button_sortcart").attr('href', '#TB_inline?height='+h90+'&width=400&inlineId=short_cart');
	$('#button_sortcart').click();
}
function getUrlParam(name) {
  var name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp(regexS);
  var results = regex.exec(window.location.href);
  if (results == null)
    return "";
  else
    return results[1];
}

jQuery(document).ready(function () {
	jQuery('.cart_remove').live('click', function () {
		if (!confirm('<?php echo $text_confirm; ?>')) {
			return false;
		}
		jQuery(this).removeClass('cart_remove').addClass('cart_remove_loading');
		jQuery.ajax({
			type: 'post',
			url: 'index.php?route=module/cart/callback',
			dataType: 'html',
			data: 'remove=' + this.id,
			success: function (html) {
				jQuery('#module_cart .middle').html(html);
				if (getUrlParam('route').indexOf('checkout') != -1) {
					window.location.reload();
				}
			}
		});
	});
});
</script>